package com.yootk.util;

import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class DateUtil {
    private static final String DATE_PATTERN = "yyyy-MM-dd" ;
    private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(DATE_PATTERN) ;
    private static final ZoneId ZONE_ID = ZoneId.systemDefault() ;
    public static Date stringToDate(String date){
        LocalDate dateTime = LocalDate.parse(date,DATE_TIME_FORMATTER) ;
        Instant instant = dateTime.atStartOfDay().atZone(ZONE_ID).toInstant();
        return Date.from(instant) ;
    }
}
